package com.shebao.utils;

import java.util.Calendar;

public class DateUtil {
	public static String printDate(){
		Calendar now = Calendar.getInstance();
		StringBuilder sb=new StringBuilder();
		sb.append(now.get(Calendar.YEAR)).append("年").append((now.get(Calendar.MONTH) + 1)).append("月").append(now.get(Calendar.DAY_OF_MONTH)).append("日");
		return sb.toString();
	}
	
	public static String printCodeDate(){
		Calendar now = Calendar.getInstance();
		now.add(Calendar.MONTH, 2);
		now.add(Calendar.DAY_OF_MONTH, -2);
		StringBuilder sb=new StringBuilder();
		String month=String.valueOf((now.get(Calendar.MONTH) + 1));
		if(month.length()<2){
			month="0"+month;
		}
		String day=String.valueOf(now.get(Calendar.DAY_OF_MONTH));
		if(day.length()<2){
			day="0"+day;
		}
		sb.append(now.get(Calendar.YEAR)).append("年").append(month).append("月").append(day).append("日");
		return sb.toString();
	}
	public static void main(String[] args) {
		System.out.println(printCodeDate());
	}
}
